def max_sub_str(string):
    """
    :param string: 字符串
    """
    result = ''
    for i in range(len(string) - 1):
        if string:
            max_chr = max(string)
            string = string.split(max_chr)[1]
            result += max_chr
        else:
            break

    return result


print(max_sub_str('jiangzemin'))
print(max_sub_str('xijinping'))
print(max_sub_str('sunwukong'))
